package reflectx

import (
	"reflect"
	"unsafe"
)

// IsPointerZero 判断unsafe.Pointer指向数据是否零值
func IsPointerZero(p unsafe.Pointer, typ reflect.Type) bool {
	r := nil == p || uintptr(p) == 0 || reflect.ValueOf(p).IsNil()
	if r {
		return true
	}
	val := reflect.NewAt(typ, p).Elem()
	return val.IsZero()
}
